package com.qianyu.project.mapper.provider.mfy;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qianyu.project.entity.DeviceCollect;
import com.qianyu.project.entity.DeviceRepair;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.StringUtils;

import java.util.Map;

/**
 * @Author mfy
 * @desc
 */
public class DeviceRepairProvider {
    public String Mylist(IPage<DeviceRepair> page, Map<String, String> params){
        return new SQL(){
            {
                SELECT("*");
                FROM(" device_repair dr,system_user su,dept d,project_info pi,material_info mi,emp e ");
                WHERE("dr.did=d.id and dr.p_id=pi.id and dr.fill_user=su.id and mi.id=dr.material_id and e.id =dr.eid");
                if(!StringUtils.isEmpty(params.get("approveStatus"))){
                    WHERE("dr.approve_status = '"+params.get("approveStatus")+"'");
                }

            }
        }.toString();
    }

    public String listNopage(Map<String, String> params){
        return new SQL(){
            {
                SELECT("*");
                FROM(" device_repair dr,system_user su,dept d,project_info pi,material_info mi,emp e ");
                WHERE("dr.did=d.id and dr.p_id=pi.id and dr.fill_user=su.id and mi.id=dr.material_id and e.id =dr.eid");
                if(!StringUtils.isEmpty(params.get("approveStatus"))){
                    WHERE("dc.approve_status = '"+params.get("approveStatus")+"'");
                }
            }
        }.toString();
    }
}
